package com.hualan.domain;

import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 课程表，存储所有课程信息
 * @TableName course
 */
@Data
public class Course implements Serializable {
    /**
     * 主键，自增
     */
    private Long id;

    /**
     * 课程名称
     */
    private String coursename;

    /**
     * 列表图URL
     */
    private String tabularchart;

    /**
     * 课程时长
     */
    private String coursetime;

    /**
     * 课件数量
     */
    private Integer coursemount;

    /**
     * 课程简介
     */
    private String courseintroduce;

    /**
     * 适用人群
     */
    private String applicablepopulation;

    /**
     * 课程分类id，外键关联courseType表
     */
    private Integer typeId;

    /**
     * 学习收获
     */
    private String learnharvest;

    /**
     * 订阅须知
     */
    private String subscriptionnotice;

    /**
     * 阅读量
     */
    private Integer readingquantity;

    /**
     * 咨询师id，外键关联teacher表
     */
    private Long teacherId;

    /**
     * 课程视频URL
     */
    private String coursevideo;

    /**
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = " yyyy-mm-dd hh-mm-ss")
    private Date createtime;

    /**
     * 更新时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = " yyyy-mm-dd hh-mm-ss")
    private Date updatetime;


    private UserCourse userCourse;

    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Course other = (Course) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getCoursename() == null ? other.getCoursename() == null : this.getCoursename().equals(other.getCoursename()))
            && (this.getTabularchart() == null ? other.getTabularchart() == null : this.getTabularchart().equals(other.getTabularchart()))
            && (this.getCoursetime() == null ? other.getCoursetime() == null : this.getCoursetime().equals(other.getCoursetime()))
            && (this.getCoursemount() == null ? other.getCoursemount() == null : this.getCoursemount().equals(other.getCoursemount()))
            && (this.getCourseintroduce() == null ? other.getCourseintroduce() == null : this.getCourseintroduce().equals(other.getCourseintroduce()))
            && (this.getApplicablepopulation() == null ? other.getApplicablepopulation() == null : this.getApplicablepopulation().equals(other.getApplicablepopulation()))
            && (this.getTypeId() == null ? other.getTypeId() == null : this.getTypeId().equals(other.getTypeId()))
            && (this.getLearnharvest() == null ? other.getLearnharvest() == null : this.getLearnharvest().equals(other.getLearnharvest()))
            && (this.getSubscriptionnotice() == null ? other.getSubscriptionnotice() == null : this.getSubscriptionnotice().equals(other.getSubscriptionnotice()))
            && (this.getReadingquantity() == null ? other.getReadingquantity() == null : this.getReadingquantity().equals(other.getReadingquantity()))
            && (this.getTeacherId() == null ? other.getTeacherId() == null : this.getTeacherId().equals(other.getTeacherId()))
            && (this.getCoursevideo() == null ? other.getCoursevideo() == null : this.getCoursevideo().equals(other.getCoursevideo()))
            && (this.getCreatetime() == null ? other.getCreatetime() == null : this.getCreatetime().equals(other.getCreatetime()))
            && (this.getUpdatetime() == null ? other.getUpdatetime() == null : this.getUpdatetime().equals(other.getUpdatetime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getCoursename() == null) ? 0 : getCoursename().hashCode());
        result = prime * result + ((getTabularchart() == null) ? 0 : getTabularchart().hashCode());
        result = prime * result + ((getCoursetime() == null) ? 0 : getCoursetime().hashCode());
        result = prime * result + ((getCoursemount() == null) ? 0 : getCoursemount().hashCode());
        result = prime * result + ((getCourseintroduce() == null) ? 0 : getCourseintroduce().hashCode());
        result = prime * result + ((getApplicablepopulation() == null) ? 0 : getApplicablepopulation().hashCode());
        result = prime * result + ((getTypeId() == null) ? 0 : getTypeId().hashCode());
        result = prime * result + ((getLearnharvest() == null) ? 0 : getLearnharvest().hashCode());
        result = prime * result + ((getSubscriptionnotice() == null) ? 0 : getSubscriptionnotice().hashCode());
        result = prime * result + ((getReadingquantity() == null) ? 0 : getReadingquantity().hashCode());
        result = prime * result + ((getTeacherId() == null) ? 0 : getTeacherId().hashCode());
        result = prime * result + ((getCoursevideo() == null) ? 0 : getCoursevideo().hashCode());
        result = prime * result + ((getCreatetime() == null) ? 0 : getCreatetime().hashCode());
        result = prime * result + ((getUpdatetime() == null) ? 0 : getUpdatetime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", coursename=").append(coursename);
        sb.append(", tabularchart=").append(tabularchart);
        sb.append(", coursetime=").append(coursetime);
        sb.append(", coursemount=").append(coursemount);
        sb.append(", courseintroduce=").append(courseintroduce);
        sb.append(", applicablepopulation=").append(applicablepopulation);
        sb.append(", typeId=").append(typeId);
        sb.append(", learnharvest=").append(learnharvest);
        sb.append(", subscriptionnotice=").append(subscriptionnotice);
        sb.append(", readingquantity=").append(readingquantity);
        sb.append(", teacherId=").append(teacherId);
        sb.append(", coursevideo=").append(coursevideo);
        sb.append(", createtime=").append(createtime);
        sb.append(", updatetime=").append(updatetime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}